package com.dynamic.datasource.dynamicdatasource.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dynamic.datasource.dynamicdatasource.mapper.UserMapper;
import com.dynamic.datasource.dynamicdatasource.model.User;
import org.springframework.stereotype.Service;

/**
 * UserService
 *
 * @author songfei
 * @date 2021/4/22 16:37
 */
@Service
public class UserService extends ServiceImpl<UserMapper, User> {


    public int masterCount() {
        return baseMapper.selectCount(Wrappers.emptyWrapper());
    }

    @DS("slave_1")
    public int slaveCount() {
        return baseMapper.selectCount(Wrappers.emptyWrapper());
    }
}
